# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=hotspot
pkgver=1.2.0
pkgrel=1
pkgdesc="The Linux perf GUI for performance analysis"
url="https://github.com/KDAB/hotspot"
# mips, s390x: undefined reference to 'QDataStream::Version qbswap<QDataStream::Version>(QDataStream::Version)'
# armhf: missing qtdeclarative
arch="all !s390x !armhf !mips !mips64"
license="GPL-2.0-or-later"
makedepends="cmake qt5-qtbase-dev elfutils-dev gettext-dev extra-cmake-modules
	threadweaver-dev ki18n-dev kconfigwidgets-dev kcoreaddons-dev kitemviews-dev
	kitemmodels-dev kio-dev solid-dev kwindowsystem-dev"
options="!check" # wonky tests
source="https://github.com/KDAB/hotspot/releases/download/v$pkgver/hotspot-v$pkgver.tar.gz"
builddir="$srcdir/$pkgname-v$pkgver"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		${CMAKE_CROSSOPTS} .
	make
}

check() {
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	make DESTDIR="$pkgdir" install
	mkdir -p "$pkgdir"/usr/share/applications
	cp hotspot.desktop "$pkgdir"/usr/share/applications
}

sha512sums="65b00a8c4ff3a0533691125b9c45f8114fa622aecb809429aae49c500e3e289162f7e02cdb9af469d2a95dae3c9e7bb859311c85db74425497a1676000b928e2  hotspot-v1.2.0.tar.gz"
